\(\int \cot (x) \sqrt {a+a \tan ^2(x)} \, dx\) [261]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 15, antiderivative size = 24 \[ \int \cot (x) \sqrt {a+a \tan ^2(x)} \, dx=-\sqrt {a} \text {arctanh}\left (\frac {\sqrt {a \sec ^2(x)}}{\sqrt {a}}\right ) \]

[Out]

-arctanh((a*sec(x)^2)^(1/2)/a^(1/2))*a^(1/2)

Rubi [A] (verified)

Time = 0.09 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.267, Rules used = {3738, 4209, 65, 213} \[ \int \cot (x) \sqrt {a+a \tan ^2(x)} \, dx=-\sqrt {a} \text {arctanh}\left (\frac {\sqrt {a \sec ^2(x)}}{\sqrt {a}}\right ) \]

[In]

Int[Cot[x]*Sqrt[a + a*Tan[x]^2],x]

[Out]

-(Sqrt[a]*ArcTanh[Sqrt[a*Sec[x]^2]/Sqrt[a]])

Rule 65

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[{p = Denominator[m]}, Dist[p/b, Sub
st[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] &
& NeQ[b*c - a*d, 0] && LtQ[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntLinearQ[a,
b, c, d, m, n, x]

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 3738

Int[(u_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^2)^(p_), x_Symbol] :> Int[ActivateTrig[u*(a*sec[e + f*x]^2)^p]
, x] /; FreeQ[{a, b, e, f, p}, x] && EqQ[a, b]

Rule 4209

Int[((b_.)*sec[(e_.) + (f_.)*(x_)]^2)^(p_.)*tan[(e_.) + (f_.)*(x_)]^(m_.), x_Symbol] :> Dist[b/(2*f), Subst[In
t[(-1 + x)^((m - 1)/2)*(b*x)^(p - 1), x], x, Sec[e + f*x]^2], x] /; FreeQ[{b, e, f, p}, x] &&  !IntegerQ[p] &&
 IntegerQ[(m - 1)/2]

Rubi steps \begin{align*} \text {integral}& = \int \cot (x) \sqrt {a \sec ^2(x)} \, dx \\ & = \frac {1}{2} a \text {Subst}\left (\int \frac {1}{(-1+x) \sqrt {a x}} \, dx,x,\sec ^2(x)\right ) \\ & = \text {Subst}\left (\int \frac {1}{-1+\frac {x^2}{a}} \, dx,x,\sqrt {a \sec ^2(x)}\right ) \\ & = -\sqrt {a} \text {arctanh}\left (\frac {\sqrt {a \sec ^2(x)}}{\sqrt {a}}\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.06 (sec) , antiderivative size = 32, normalized size of antiderivative = 1.33 \[ \int \cot (x) \sqrt {a+a \tan ^2(x)} \, dx=\arctan \left (\sqrt {-\cos ^2(x)}\right ) \sqrt {-\cos ^2(x)} \sqrt {a \sec ^2(x)} \]

[In]

Integrate[Cot[x]*Sqrt[a + a*Tan[x]^2],x]

[Out]

ArcTan[Sqrt[-Cos[x]^2]]*Sqrt[-Cos[x]^2]*Sqrt[a*Sec[x]^2]

Maple [A] (verified)

Time = 0.37 (sec) , antiderivative size = 20, normalized size of antiderivative = 0.83

method result size
default \(\ln \left (-\cot \left (x \right )+\csc \left (x \right )\right ) \cos \left (x \right ) \sqrt {a \sec \left (x \right )^{2}}\) \(20\)
risch \(-2 \sqrt {\frac {a \,{\mathrm e}^{2 i x}}{\left ({\mathrm e}^{2 i x}+1\right )^{2}}}\, \ln \left ({\mathrm e}^{i x}+1\right ) \cos \left (x \right )+2 \sqrt {\frac {a \,{\mathrm e}^{2 i x}}{\left ({\mathrm e}^{2 i x}+1\right )^{2}}}\, \ln \left ({\mathrm e}^{i x}-1\right ) \cos \left (x \right )\) \(62\)

[In]

int(cot(x)*(a+a*tan(x)^2)^(1/2),x,method=_RETURNVERBOSE)

[Out]

ln(-cot(x)+csc(x))*cos(x)*(a*sec(x)^2)^(1/2)

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 63, normalized size of antiderivative = 2.62 \[ \int \cot (x) \sqrt {a+a \tan ^2(x)} \, dx=\left [\frac {1}{2} \, \sqrt {a} \log \left (\frac {a \tan \left (x\right )^{2} - 2 \, \sqrt {a \tan \left (x\right )^{2} + a} \sqrt {a} + 2 \, a}{\tan \left (x\right )^{2}}\right ), \sqrt {-a} \arctan \left (\frac {\sqrt {a \tan \left (x\right )^{2} + a} \sqrt {-a}}{a}\right )\right ] \]

[In]

integrate(cot(x)*(a+a*tan(x)^2)^(1/2),x, algorithm="fricas")

[Out]

[1/2*sqrt(a)*log((a*tan(x)^2 - 2*sqrt(a*tan(x)^2 + a)*sqrt(a) + 2*a)/tan(x)^2), sqrt(-a)*arctan(sqrt(a*tan(x)^
2 + a)*sqrt(-a)/a)]

Sympy [F]

\[ \int \cot (x) \sqrt {a+a \tan ^2(x)} \, dx=\int \sqrt {a \left (\tan ^{2}{\left (x \right )} + 1\right )} \cot {\left (x \right )}\, dx \]

[In]

integrate(cot(x)*(a+a*tan(x)**2)**(1/2),x)

[Out]

Integral(sqrt(a*(tan(x)**2 + 1))*cot(x), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 38 vs. \(2 (18) = 36\).

Time = 0.54 (sec) , antiderivative size = 38, normalized size of antiderivative = 1.58 \[ \int \cot (x) \sqrt {a+a \tan ^2(x)} \, dx=-\frac {1}{2} \, \sqrt {a} {\left (\log \left (\cos \left (x\right )^{2} + \sin \left (x\right )^{2} + 2 \, \cos \left (x\right ) + 1\right ) - \log \left (\cos \left (x\right )^{2} + \sin \left (x\right )^{2} - 2 \, \cos \left (x\right ) + 1\right )\right )} \]

[In]

integrate(cot(x)*(a+a*tan(x)^2)^(1/2),x, algorithm="maxima")

[Out]

-1/2*sqrt(a)*(log(cos(x)^2 + sin(x)^2 + 2*cos(x) + 1) - log(cos(x)^2 + sin(x)^2 - 2*cos(x) + 1))

Giac [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.00 \[ \int \cot (x) \sqrt {a+a \tan ^2(x)} \, dx=\frac {a \arctan \left (\frac {\sqrt {a \tan \left (x\right )^{2} + a}}{\sqrt {-a}}\right )}{\sqrt {-a}} \]

[In]

integrate(cot(x)*(a+a*tan(x)^2)^(1/2),x, algorithm="giac")

[Out]

a*arctan(sqrt(a*tan(x)^2 + a)/sqrt(-a))/sqrt(-a)

Mupad [B] (verification not implemented)

Time = 0.19 (sec) , antiderivative size = 12, normalized size of antiderivative = 0.50 \[ \int \cot (x) \sqrt {a+a \tan ^2(x)} \, dx=-\sqrt {a}\,\mathrm {atanh}\left (\sqrt {\frac {1}{{\cos \left (x\right )}^2}}\right ) \]

[In]

int(cot(x)*(a + a*tan(x)^2)^(1/2),x)

[Out]

-a^(1/2)*atanh((1/cos(x)^2)^(1/2))